package com.liuugoqing.behavioral.Iterator;

/**
 * @Author : liugq
 * @Date : 2022/7/14 16:29
 * @See : 参考类
 * @Since： JDK1.8
 * @Version : 1.0
 */
public class TestIterator {
    public static void main(String[] args) {
        StudentAggregate studentAggregate = new StudentAggregateImpl();
        studentAggregate.addStudent(new Student("李四","20"));
        studentAggregate.addStudent(new Student("王五","10"));
        studentAggregate.addStudent(new Student("赵六","23"));

        StudentIterator studentIterator = studentAggregate.getStudentIterator();
        while (studentIterator.hasNext())
            System.out.println(studentIterator.next());

    }


}
